<?php
session_start(); //we need to call PHP's session object to access it through CI
class Laporan extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->library('view');
		$this->view->set_menu('laporan');
		$this->view->set_portlet_title('Laporan');
		$this->view->set_portlet_style('portlet box blue');
		$this->view->set_view('siswa/siswa_laporan');
		$this->session_data = $this->session->userdata('user');
	}

	function index()
	{ 	
		$this->load();
		$this->load->model('m_nilai');
		$this->data['rows'] = $this->m_nilai->get_report_data($this->data['id']);
		$this->data['title'] = 'Home';
		$this->view->show($this->data);
	}
	
	function load(){
		if($this->session_data){
			$this->data['id'] = $this->session_data['id'];
			$this->data['username'] = $this->session_data['username'];
			$this->data['nama'] = $this->session_data['nama'];
		}else{
			redirect('user/login', 'refresh');
		}
	}
	
	function export($id)
	{
		$this->load->model('m_nilai');
		$data['rows'] = $this->m_nilai->get_all_data($id);
		$data['name'] = "Laporan_Hasil_Test";
		$this->load->view('siswa/siswa_export_laporan', $data);
	}
}
?>